package com.fiap.dao;

import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;

import com.fiap.sqlite.DatabaseHelper;

public class DatabaseOperations {

	private DatabaseHelper databaseHelper;
	private SQLiteDatabase database;

	public DatabaseOperations(Context context) {
		databaseHelper = new DatabaseHelper(context);
	}

	public void open() throws SQLException {	
		database = databaseHelper.getWritableDatabase();		
   }

	public SQLiteDatabase getDatabase() {
		// Always open the database before returning it.
		open();
		return database;
	}
}
